import Vue from 'vue'
import Vuex from "vuex"
Vue.use(Vuex);

// import {getInTheaters} from "../apis"

export default new Vuex.Store({
	state:{
		//[{questionId:1,answer:[A,B,C]},{questionId:2,answer:[A,D]}]
		answerList: [],
		num: 0
	},
	mutations:{
		addAnswer(state,answer){
			var flag=false;   //没有找到
			
			state.answerList.some(item=>{
				if(item.questionId==answer.questionId){
					item.answer=answer;
					flag=true;
					return true;
				}
			})
			if(!flag){
				state.answerList.push(answer)
			}
		}
	}
})